﻿CREATE PROCEDURE [dbo].[AddActivityLink]
	@Activity1 uniqueidentifier,
	@Activity2 uniqueidentifier,
	@Condition nvarchar(max),
	@Comment nvarchar(max),
    @IsDeleted bit,
    @CreatedBy uniqueidentifier,
	@CreatedOn datetime,
    @LastChanged datetime,
	@LastChangedBy uniqueidentifier,

	@TimeStamp timestamp output

AS

	INSERT INTO ActivityLink

	(Activity1, Activity2, Condition, Comment, IsDeleted, CreatedBy, CreatedOn, LastChanged, LastChangedBy)

	VALUES 

	(@Activity1, @Activity2, @Condition, @Comment, @IsDeleted, @CreatedBy, @CreatedOn, @LastChanged, @LastChangedBy)

	SELECT @TimeStamp = [TimeStamp]

	FROM ActivityLink WHERE Activity1=@Activity1 AND Activity2=@Activity2

RETURN 0